#include "os.h"

OS::OS()
{
    if(Planner::getSingletonPtr() == 0)
    {
        planner = new Planner();
    }
    if(ResourceAllocator::getSingletonPtr() == 0)
    {
        resourceAllocator = new ResourceAllocator();
    }

    planner->createProcess(0, RUN, 99, new StartStop());
}

OS::~OS()
{
    delete resourceAllocator;
    delete planner;
}

template<> OS* Singleton<OS>::msSingleton = 0;
OS* OS::getSingletonPtr(void)
{
    return msSingleton;
}

OS& OS::getSingleton(void)
{
    assert( msSingleton );  return ( *msSingleton );
}
//-----------------------------------------------------------------------

void OS::Run() {
    //qDebug() << "run @ OS::Run";
    planner->Run();

}
